//
//  IMIEnum.h
//  MiHome
//
//  Created by 杨俊 on 2017/9/3.
//  Copyright © 2017年 小米移动软件. All rights reserved.
//

#import "ILVideoEnum.h"

//播放器类型
typedef NS_ENUM(NSInteger, ILPlayerType) {
    ILPlayerType_LIVE = 1, //直播
    ILPlayerType_VOD,      //回看
    ILPlayerType_HLS,      //云存
    ILPlayerType_IMITS,    //创米云，系统播放器支持m3u8
    ILPlayerType_LOCAL_LIVE,     //本地直连直播
    ILPlayerType_LOCAL_VOD,     //本地直连回看
};

//渲染View 类型 ,初始值10 不能随意修改,防止和ILPlayerType 或其他type 由于bug 造成重复
typedef NS_ENUM(NSInteger, ILRenderType) {
    ILRenderType_Decoder_out = 10,      //创米标准播放器渲染视图                           --外部解码
    ILRenderType_Decoder_in             //此类型属于历史遗留,目前用于本地直连自定义视频流view    --内部解码
};


//倍速
typedef NS_ENUM(NSUInteger, ILPlayerSpeed) {
    ILPlayerSpeed_NORMAL = 4,    //1倍速
    ILPlayerSpeed_FAST_2,        //2倍速
    ILPlayerSpeed_FAST_4,        //4倍速
    ILPlayerSpeed_FAST_8,        //8倍速
    ILPlayerSpeed_FAST_16,       //16倍速
};

//画面比例
typedef NS_ENUM(NSUInteger, ILPlayerAspectRatio) {
    ILPlayerASPECT_FIT_PARENT = 1,    //它会自己适应控件大小它不保证整个 视图全为我们所播放的视频，但是保证了视频的完全显示
    ILPlayerASPECT_FILL_HEIGHT_PARENT,        //伸缩视频填满屏幕（高度跟随视图，宽度可超出屏幕）,但不会改变视频比例
    ILPlayerASPECT_WRAP_CONTENT,        //
    ILPlayerASPECT_MATCH_PARENT,        //
    ILPlayerASPECT_16_9_FIT_PARENT,       //根据屏幕尺寸，自适应16：9
    ILPlayerASPECT_4_3_FIT_PARENT,       //根据屏幕尺寸，自适应4：3
};
// 播放器、对讲事件
typedef NS_ENUM(NSUInteger, ILPlayerEventCode) {
    //通用 ---- start
    ILEventChangeCode_BitRate = 10013,             //实时码率
//    ILEventChangeCode_Connect = 10012,             //直播、回看、云存-连接成功 2022/11/23 废弃，使用ILEventChangeCode_VideoBuffing 缓冲中代替
    ILEventChangeCode_Ready = 10011,               //直播、回看、云存-准备完成进入播放状态。出现第一个i帧
    ILEventChangeCode_Stop = 99007,                //直播、回看、云存-播放成功停止（正常停止）
    ILEventChangeCode_Vide_Size_Change = 99017,  //画面宽和高发生了变化

    
    ILEventChangeCode_Pause = 99005,        //回看、云存-暂停播放成功完成
    ILEventChangeCode_ReplayPlayEnd = 10096,       //回看、云存-播放完成 等同于onPlayCompletionBlock
    ILEventChangeCode_ReplayCurrentTime = 10014,   //回看、云存-当前时间回调

  
    ILEventChangeCode_IntercomStart= 10100,     //语音对讲-连接服务器成功
    ILEventChangeCode_IntercomReady = 10098,       //语音对讲-准备完成
    ILEventChangeCode_IntercomStop = 10099,        //语音对讲-停止（正常停止）
    
    ILEventChangeCode_VideoStart = 10020,        //网络视频-开始（正常）
    ILEventChangeCode_VideoBuffing = 10012,        //网络视频-缓冲中
    ILEventChangeCode_VideoStop = 10022,        //网络视频-停止

    //通用 ----end
    

//   内部转换
    ILPlayerEventCode_VideoProgress = 10200,
    ILPlayerEventCode_ReadyForDisplay = 10201,
    ILPlayerEventCode_PlaybackStalled = 10202,
    ILPlayerEventCode_PlaybackResume = 10203,
};

// 播放器、对讲错误事件
typedef NS_ENUM(NSUInteger, ILPlayerErrorCode) {
    ILPlayerErrorCode_PlayerErrorUnknown = 2000,  //播放器未知错误
    ILPlayerErrorCode_PlayerErrorDataSource = 2001,   //数据源错误或未设置
    ILPlayerErrorCode_PlayerErrorGetURL = 2002,       //获取链接失败
    ILPlayerErrorCode_PlayerErrorUrl = 2003,          //无效的播放地址
    ILPlayerErrorCode_PlayerErrorEncrypt = 2004,      //无效的解密密钥
    ILPlayerErrorCode_PlayerErrorStart = 2005,        //启动失败
    ILPlayerErrorCode_PlayerErrorConnect = 2006,      //建立连接失败
    ILPlayerErrorCode_PlayerErrorStream = 2007,       //接收数据流失败
    ILPlayerErrorCode_PlayerErrorDecode = 2008,       //解码错误
    ILPlayerErrorCode_PlayerErrorStop = 2009,         //关闭失败

    ILPlayerErrorCode_IntercomErrorUnknown = 10 ,    //对讲未知错误
    ILPlayerErrorCode_IntercomErrorGetURL = 11,     //获取链接失败
    ILPlayerErrorCode_IntercomErrorInUse = 12,      //正在使用
    ILPlayerErrorCode_IntercomErrorStart = 13,      //启动对讲失败
    ILPlayerErrorCode_IntercomErrorConnect = 14,    //语音流建立失败
    ILPlayerErrorCode_IntercomErrorParams = 15,     //对讲参数错误
    ILPlayerErrorCode_IntercomErrorStream = 16,     //接收数据流失败
    ILPlayerErrorCode_IntercomErrorDecode = 17,     //解码错误
    ILPlayerErrorCode_IntercomErrorRecorder = 18,   //录音失败
    ILPlayerErrorCode_IntercomErrorSendData = 19,   //发送语音对讲数据失败
    ILPlayerErrorCode_IntercomErrorStop = 20,       //关闭失败
};

// 播放器、对讲状态
typedef NS_OPTIONS(NSUInteger, ILPlayerState) {
    ILPlayerState_Idle = 0,            // 空闲
    ILPlayerState_Buffering = 1 << 1,  // 缓冲中
    ILPlayerState_StartPlay = 1 << 2,  // 开始播放
    ILPlayerState_PausePlay = 1 << 3,  // 暂停播放
//    ILPlayerState_Background = 1 << 4, // 切换到后台
    ILPlayerStateMax,
};

// 播放器、对讲状态
typedef NS_OPTIONS(NSUInteger, ILPlayerConnectType) {
    /// 直连
    ILPlayerConnectTypeLOCAL = 0,
    /// 穿透
    ILPlayerConnectTypeSRFLX = 1,
    /// 云转
    ILPlayerConnectTypeRELAY = 2,
    /// 自由直连
    ILPlayerConnectTypeLOCALTCP = 3,
    /// P2P ipv6直连
    ILPlayerConnectTypeTYPE_IPV6=4,
};

//// 老播放器、对讲状态
//typedef NS_ENUM(NSUInteger, IMIMediaPlayerConnectState){
//    IMIPlayerStateIdle,
//    IMIPlayerStateBuffering,
//    IMIPlayerStatePlaying,
//    IMIPlayerStatePause,
//    IMIPlayerStateMax
//};

//typedef NS_ENUM(NSInteger, IMIEnhanceRenderAlgoType) {
//    IMIEnhanceRenderAlgoType_EnableLensCorrent = 0,
//    IMIEnhanceRenderAlgoType_EnableLensCorrentOSD,
//    IMIEnhanceRenderAlgoType_DisableLensCorrent,
//    IMIEnhanceRenderAlgoType_EnableLensCorrentOSD_021E01
//};




FOUNDATION_EXPORT NSString *const KEY_U;

FOUNDATION_EXPORT const int RETRY_C;

/**
 * 音频编码类型
 */
typedef NS_ENUM(NSInteger, AudioStreamType) {
    /** PCM格式 */
    IL_MEDIA_AUDIO_ENC_PCM = 0,
    /** G711a格式 */
    IL_MEDIA_AUDIO_ENC_G711A = 1,
    /** AAC_LC格式 */
    IL_MEDIA_AUDIO_ENC_AAC_LC = 2,
    /** G711u格式 */
    IL_MEDIA_AUDIO_ENC_G711U = 3,
    /** AMRNB格式*/
    IL_MEDIA_AUDIO_ENC_AMRNB = 4,
    /** OPUS格式 */
    IL_MEDIA_AUDIO_ENC_OPUS = 5,
};





